/**
 * Created by Administrator on 2015/11/23.
 */
$(function(){
    var p= 0,t=0;
    if ($("#searchArea").length == 0) return;
    var snheight=$("#searchArea").offset().top;
    $(document).scroll(function(){
        p = $(this).scrollTop();
        if(p>=t&&p>=snheight){
            snon();
        }else{
            if(p<=t&&p<=snheight){
                snona();
            }
        }
        setTimeout(function(){t = p;},0);
    });
    function snon(){
        var sn=$(".scrollnew .portlet-title").outerWidth();
        $(".scrollnew .portlet-title").css({"position":"fixed","zIndex":"1000","width":sn,"top":"0"});
    };
    function snona(){
        var sn=$(".scrollnew .portlet-title").outerWidth();
        $(".scrollnew .portlet-title").css({"position":"static","zIndex":"1000","width":sn,"top":"0"});
    };

    $(".snclick").css("cursor","pointer");
    $(".snclick").click(function(){
        //alert(1)
        setTimeout(function(){$(document).scrollTop(snheight)},200)
    })
});